<?php

namespace app\validate;

use app\base\BaseValidate;

/**
 * 验证器-UserValidate
 * Class UserValidate
 * @package app\validate
 */
class UserValidate extends BaseValidate
{
    protected $rule = [
        'id' => 'require|number',
        'phone|手机' => 'require|mobile',
        'password|密码' => 'require|max:255',
        'sex|性别' => 'require|in:1,2,3',
        'nick_name|昵称' => 'require',
        'head_img|头像' => 'require',
        'wx_open_id|微信open_id' => 'require',
        'status|状态' => 'in:1,2',
        'member_level|会员状态' => 'in:0,1'
    ];

    //验证场景-会员状态修改
    public function sceneUpMember()
    {
        return $this->only(['id', 'member_level']);
    }

    //验证场景-会员状态修改
    public function sceneUpName()
    {
        return $this->only(['id', 'name']);
    }
}
